<?php
	require 'membersession.class.php';
	require 'admin/sql.class.php';
	$arr = MemberSessionInfo::checkMemberLogin();
	if (is_null($arr)) {
		$currentMobile = "";
		$currentPassword = "";
		$currentAvatar = "";
		$currentGender = 0;
		$currentUsername = "";
		$currentNickname = "";
	} else {
		$currentMobile = $arr["mobile"];
		$currentPassword = $arr["password"];
		$currentAvatar = $arr["avatar"];
		$currentGender = $arr["gender"];
		$currentUsername = $arr["username"];
		$currentNickname = $arr["nickname"];
	}
?>
<!DOCTYPE html>
<html>
<head>
	<title>列表</title>
	<link rel="stylesheet" type="text/css" href="/mcnews/css/mcnews.css">
</head>
<script type="text/javascript">
	function checkLoginState(needShow, type) {
		var currentType = "registerMaskView";
		var display = "none";
		if (type == 1) {
			currentType = "loginMaskView"
		}

		if (needShow == true) {
			display = "inline";
		}
		document.getElementById(currentType).style.display=display;
	}

	function showLogin() {
		checkLoginState(true, 1);
	}

	function dissmissLogin() {
		checkLoginState(false, 1);
	}

	function showRegister() {
		checkLoginState(true, 0);
	}

	function dissmissRegister() {
		checkLoginState(false, 0);
	}

</script>

<body>

<div class="loginMaskView" id="loginMaskView" onclick="dissmissLogin();">
	<div class="loginSubView">
		<iframe class="loginView" src="login.php" frameborder="0"></iframe>
	</div>
</div>

<div class="loginMaskView" id="registerMaskView" onclick="dissmissRegister();">
	<div class="loginSubView">
		<iframe class="loginView" src="register.php" frameborder="0"></iframe>
	</div>
</div>

<div class="header">
	<?php 
		$h = "";
		if (empty($currentMobile)) {
			$h = "<div class='rightbutton'>
					<a onclick='showLogin();'>登录</a>
					<a onclick='showRegister();'>注册</a>
				</div>";
		} else {
			$h = "<div class='rightbutton'>
					<img src='" . $currentAvatar . "'>
					<a>" . $currentMobile . "</a>
					<a href='outlogin.php'>退出</a>
				</div>";
		}
		echo $h;
	?>	
</div>

<div class="divbody">
	<!--导航栏-->
	<div class="nav">
     <ul>
       <li><a href="index.php">首页</a></li>
       <li><a href="#">文章</a></li>
       <li><a href="#">故事</a></li>
       <li><a href="#">散文</a></li>
       <li><a href="#">诗歌</a></li>
       <li><a href="#">日记</a></li>
       <li><a href="#">小说</a></li>
      </ul>
	</div>

	<!-- 内容 -->
	<div class="content">
		<div class="leftList">
		<?php
			$arr = getContentDetail($_GET["id"]);

			// foreach ($arr as $key => $value) {
			// 	echo "key = " . $key . ", value = " . $value . "<br/>";
			// }
			//print_r($arr);
		?>

		<h3><?php echo $arr["title"]; ?></h3>
		<h5><?php echo "时间:" . $arr["createTime"]; ?></h5>
		<p><?php echo $arr["content"]; ?></p>
			
		</div>
		<div class="rightList">
		
		</div>
	</div>

</div>

</body>
</html>